package vtt.android.cartoon_video.activities;

import vtt.android.cartoon_video.BaseApplication;
import vtt.android.cartoon_video.R;
import vtt.android.library.activities.VttBaseActionBarActivity;
import android.os.Bundle;

import com.startapp.android.publish.StartAppAd;

public class BaseActivity extends VttBaseActionBarActivity {

    private StartAppAd startAppAd = new StartAppAd(this);
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        initActionBar();
        // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

    protected void initActionBar() {
        actionBar = getSupportActionBar();
        if (actionBar != null) {
            // actionBar.setBackgroundDrawable(getResources().getDrawable(R.drawable.background_repeat_white));
            actionBar.setTitle(R.string.app_name);
            actionBar.hide();
        }
    }

    /**
     * get main application
     * @return BaseApplication
     */
    public BaseApplication getMainApplication(){
        return (BaseApplication) getApplication();
    }
    
    @Override
    protected void onResume() {
        super.onResume();
        log.d("VTT>>> " + "onResume");
        BaseApplication.mIsMainActivityRunning = true;
        
        // start app
        startAppAd.onResume();
    }
    
    @Override
    protected void onStop() {
        super.onStop();
        log.d("VTT>>> " + "onStop");
        BaseApplication.mIsMainActivityRunning = false;
        
        // start app
        startAppAd.onPause();
    }
}
